CodeWiz v1.32
CodeWiz Developer Studio Add-In - All the macros you need in DevStudio

WLANBIT - http://www.wlanbit.com
Teemu LĪ£tti - teemu.latti@wlanbit.com


Introduction


What is it?

CodeWiz is a Developer Studio Add-In. Add-Ins are small DLLs which add functionality to your development environment. If you have ever used Macros, Add-Ins do the same thing but in more powerful way.

CodeWiz is designed specifically for professional C++ developers. It contains several commands which help you with the most basic coding activities you do daily. See the Commands section.

Why not use Macros?

I used to have several Macros installed into my Developer Studio, and they had some really nice features. For example I could not live without the "Friend File" macro after using it for a while.

But then there was always this hazzle to set them up (keyboard shortcuts and stuff). And the worst thing was that they crashed my DevStudio several times and were really slow to load up and use.

In this Add-In I can get all the functionality I want at once, and the installation is really fast to do. Since the DLL is always loaded in memory as a compiled executable, it is very fast to use and much more reliable. And have you ever tried to present a dialog or any other complex user interface from a Macro?

Which versions of Developer Studio are supported?

This Add-In is tested with versions 5 and 6.

Where can I find the latest version?

This software is constantly under heavy development, so be sure to get the latest version from http://www.wlanbit.com/devproducts/CodeWiz/.


Installation

New Installation

Download CodeWiz.zip (or open directly here).
Unpack all the files into any directory you want.
Open your Developer Studio and choose the menu "Tools/Customize".
Click to the "Add-ins and Macro files" page.
Choose "Browse".
Locate "CodeWiz.dll". Be sure to have the file type as "Add-ins (.dll)".
Now the DLL is loaded and should have the checkmark on it. Close the window.
A new toolbar with two buttons has appeared and CodeWiz is ready for use.

Update

Close your Developer Studio and overwrite the files with newer versions.
If you want to keep your existing code templates, save the file "CodeWiz.txt".


Commands

Friend File (CTRL-1)

Switches between the source and the header file. For example if you have a file called "MainFrame.cpp" active, this command will open and activate a file called "MainFrame.h".

The following file extensions are supported (in search order):

	Source files:	.cpp .c   .cc
	Header files:	.h   .hpp	 
If the searched file is not found in the current directory, the command will search from additional directories, which you can specify in Options. This enables you to keep your header and source files in different sub-directories. You can also use environment variables when specifying these directories.

Friend Member (CTRL-2)

Same as above, but also searches for the function or variable currently selected (or in the current line). Good way to quickly go to the member declaration and back.

Browse (CTRL-4)

Opens a Browse dialog, where you can shuffle through all the function and class declarations in the current file. Type part of the name, and the list will be filtered to contain only matching items.

If you press 'Backspace' when the edit box is empty, you can see a list of all the files in the current project. Another press gives you all the projects in the workspace.

Copy/Paste Members (CTRL-5 / CTRL-6)

These are very useful commands, which save you the trouble of reformatting your functions when typing them into the header file.

You start by selecting a function in the implementation file. Just paint the function(s) or leave the cursor in the same line with the function name. Then press CTRL-5. Now the function declaration has been copied into memory.

Go to the header file (use CTRL-1) and go inside the class declaration. Choose a place for your function and press CTRL-6. The function is automatically reformatted for the header file!

This also works vice versa and you are able to copy multiple functions at the same time. It actually works for data members as well, so you can copy statics for which you need an instance in the source file.

The reformatting is very smart. All additional prefixes ("static", "virtual") and default parameters are commented out in the source file and uncommented when copied to the header file.

(Un)Commentize (CTRL-7)

Commentizes each line of the selected text. If the text is already in comments, reverses the action. Fast way to temporarely commentize a block of code.

Reverse (CTRL-8)

Reverses assignment operations on each line of the selected text. The following formats of assignments are recognized:

	m_nLine=nLine;           <->  nLine=m_nLine;
	a.SetLine(nLine);        <->  nLine=a.GetLine();
	a.SetCol(b.get_Line());  <->  b.set_Line(a.GetCol());
	a << b;                  <->  a >> b;

Step Up/Down (CTRL-PageUp / PageDown)

Steps up or down in the current file. Stops in function or class declarations and some keywords.

Project Statistics

Shows statistics for projects in the current workspace. Example output:

    Project CodeWiz
               Files     Bytes   Lines
      Source      21    191262    8412
      Header      22     48682    1702
      Other       11     38345
      All         54    278289   10114

Clean

Searches the directory of your choise for futile intermediate files and deletes them freeing much disk space. You can select the directory and any file types you want to be deleted.

File Properties

Shows the standard Windows File Properties dialog for the current file.

Add Breakpoints

Adds breakpoints in the beginning of each function in the current file.


Code Templates

Code Templates are small segments of code you can write in advance and then quickly insert to your code later. This saves a lot of extra typing if you write much similar looking code.

Whenever you are editing your code, you simply go to the place you want to insert the template and then press CTRL-0 (or select the second toolbar button). In the popup-menu you can see a list of all the available templates.

With CodeWiz you can also have macros inside your Code Templates which will be replaced with their values when inserting. For example, see the following template:

	##+ Get inline
		inline $(member.type/void)
			Get$(member.short)() const
				{ return $(member.name); };
	##-
The name of the template is "Get inline" and you can find it under "Helpers"-submenu. Addition to macros, you can also include environment variables.

This template includes several macros which all use the member previously copied into memory with "Copy Members" command (see the Commands section). When you insert this template into your code, all the $() strings will be replaced with their corresponding values. For example, lets assume you have copied the member "BOOL m_bEnabled;" and insert the template. The output will be:

	inline BOOL	GetEnabled() const	{ return m_bEnabled; };
This kind of helper functions you will probably write quite a lot, if you keep your class members private.

All the code templates are stored in a special file called "CodeWiz.txt". If you want to customize your templates or add new ones, just edit this file. For quickly editing the file, choose "Edit" from the menu. Note that this command automatically sets the file type to source-file, so you can see the code in correct colors. After editing, remember to select "Reload" to apply changes.


Version History


Version 1.32

- Removed annoying error messages, when the user is not logged in as an administrator.
- Changed loading of the code templates file to be shared, so other instances of DevStudio can access it at the same time.
- Changed Friend Member to be case-sensitive.
- Changed Commentize to automatically commentize scopes.
- Added file extensions to options.
- Added "Open Folder"-command.
- Added "Copy Filename"-command.

Version 1.31

- Email and web-page addresses changed.
- Fixed the fix for Browse to detect correctly constructors.

Version 1.30

- Fixed copy/paste bug in Developer Studio 6. This problem has been annoying users (including me) from the very beginning. Thanks to Jay R Blumenstein for pointing out the cause and the fix.
- Fixed Browse to detect correctly functions, which have spaces before the bracket (as in "Func ()").
- Fixed Browse to detect correctly constructors, which have base class and member initialization (as in "Class::Class() : BaseClass()").
- Fixed Copy Members to copy class name correctly when no space between the class name and the bracket '{'.
- Changed Clean to show total bytes in more readable manner.
- Changed the report dialog (for Clean and Project Statistics) to automatically scroll to the end of the report.

Version 1.29

- Added support for environment variables.
- Fixed copy/paste. Did not work for format "int *Func()" and added extra spaces after each declaration in header files.

Version 1.28

- Changed "Step Up/Down" to stop at beg/end of file.
- Fixed "Step Up/Down". Did not recognize function which were prefixed with comments.
- Fixed "Reverse". Did not work through CTRL+8.

Version 1.27

- Changed implementation of "Save to UNIX File Format" and "Ensure Windows File Format".
- Fixed "Browse". Did not find class name correctly if it was prefixed with "ATL_NO_VTABLE" or other macros.
- Added ".cc" as new source file extension.
- Changed "Step Up/Down" to recognize more function formats.


Disclaimer and Copyright

This software is under heavy development and is being supplied as "AS IS", without any warranties, expressed or implied. The developer takes no responsibility for any damages this software might cause.

This software is Copyright Softbit Ltd. This version is freeware. It can be freely distributed if a) no fees of any sort are taken and b) the whole package is always distributed as a whole without any changes to the content. Any future versions or subsequental products have their own individual copyrights and might well be commercial.

If you have any comments or suggestions, please don't hesitate to contact me at teemu.latti@wlanbit.com. Most of the commands are designed for my personal use, so many useful features must be missing. Any suggestions are welcome.